<template>
  <view class="screen" :class="{ 'screen-show': dialog }">
    <view class="screen-content">
      <view class="content">
        <view class="content-header">
          <view class="content-header-title">课程难度</view>
          <view class="content-header-text">从易到难</view>
        </view>
        <view class="content-middle">
          <view
            class="content-middle-list"
            v-for="(item, index) in data"
            :key="item + item.title"
          >
            <view class="icon">
              <image
                class="image"
                :src="item.img"
                style="width: 71rpx; height: 71rpx"
                mode="aspectFill"
              />
              <!-- <uv-image
                class="image"
                :src="item.img"
                height="71rpx"
                width="71rpx"
                shape="circle"
                mode="aspectFill"
              ></uv-image> -->
              <text class="text">{{ index + 1 }}</text>
            </view>
            <view class="substance">
              <view class="substance-title">
                {{ item.title }}
              </view>
              <view class="substance-content">
                {{ item.content }}
              </view>
            </view>
          </view>
        </view>
        <uv-line color="#545454"></uv-line>
        <view class="content-footer">
          <view class="confirm" @click="onConfirm">确定</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { reactive, ref, watch } from 'vue';
let emit = defineEmits(['update:modelValue']);
let props = defineProps({
  modelValue: {
    type: Boolean,
    default: false,
  },
});

const dialog = ref(false);

const data = reactive([
  {
    img: '../../static/img/group1.png',
    title: '纯纯新人',
    content: '完成28节入门课程，打下坚实基础。',
  },
  {
    img: '../../static/img/group2.png',
    title: '进阶新手',
    content: '通过36节课程，深化技能，挑战新动作。',
  },
  {
    img: '../../static/img/group3.png',
    title: '小有成就',
    content: '累计48节，熟练掌握舞蹈组合，展现个性。',
  },
  {
    img: '../../static/img/group4.png',
    title: '崭露头角',
    content: '再学96节，面对高级挑战，提升技艺。',
  },
  {
    img: '../../static/img/group5.png',
    title: '百炼成钢',
    content: '完成所有阶段，技艺精湛，表演自如。',
  },
]);

watch(
  () => props.modelValue,
  val => {
    dialog.value = val;
  },
  {
    immediate: true,
  }
);

const getbackgroundImg = imageUrl => {
  return {
    'background-image': `url(${imageUrl})`,
    'background-size': 'cover',
    'background-repeat': 'no-repeat',
  };
};

const onConfirm = () => {
  emit('update:modelValue', false);
};
</script>

<style lang="scss" scoped>
.screen {
  width: 100%;
  height: 100%;
  transition: all 0.3s;
  transform: translate(0%, -100%);
  z-index: 2024;
  opacity: 1;
  position: fixed;
  display: flex;
  flex-direction: column;
  inset: 0px;
  justify-content: center;
  align-items: center;
  transition: opacity 300ms ease-out 0ms, -webkit-transform 300ms ease-out 0ms,
    transform 300ms ease-out 0ms;
  &-content {
    width: 689rpx;
    height: 1047rpx;
  }
  .content {
    font-size: 28rpx;
    background-color: #333644;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 72rpx 31rpx 61rpx;
    border-radius: 25rpx;
    &-header {
      display: flex;
      align-items: center;
      padding-left: 52rpx;
      &-title {
        color: #fff;
        font-size: 35rpx;
        font-weight: bold;
      }
      &-text {
        margin-left: 38rpx;
        font-size: 28rpx;
        color: #b1b1b1;
      }
    }
    &-middle {
      width: 100%;
      overflow: hidden;
      margin-top: 52rpx;
      padding-left: 21rpx;
      &-list {
        display: flex;
        align-items: center;
        margin-bottom: 44rpx;
        .icon {
          width: 81rpx;
          height: 81rpx;
          overflow: hidden;
          position: relative;
          .image {
            // width: 71rpx;
            // height: 71rpx;
            // border-radius: 50%;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
          .text {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 35rpx;
            color: #fff;
            font-weight: bold;
          }
        }
        .substance {
          margin-left: 35rpx;
          display: flex;
          flex-direction: column;
          &-title {
            font-size: 35rpx;
            color: #fff;
            font-weight: bold;
          }
          &-content {
            margin-top: 6rpx;
            color: #d9d9d9;
            font-size: 26rpx;
          }
        }
      }
    }
    &-footer {
      margin-top: 66rpx;
      display: flex;
      justify-content: center;
      .confirm {
        text-align: center;
        width: 298rpx;
        height: 71rpx;
        line-height: 71rpx;
        background-color: #ff7a66;
        border-radius: 78rpx;
        font-size: 35rpx;
        font-weight: bold;
        color: #fff;
      }
    }
  }
}
.screen-show {
  transform: translate(0%, 0%);
}
</style>
